



#tip:"4b93deeb" is part of the flag
#flag = "flag{" + hashlib.sha256(str(x).encode()).hexdigest() + "}"
#ms= [getRandomNBitInteger(128) for i in range(8)]= [317373385442325309490126978143569357540, 221713642615900754871455583169037656558, 196289364596638326277049734802446938300, 247061551433347435409823882059850553282, 323402141217785400810426086286247835137, 170316516030765512154283308705681130889, 238260825445985150121803064547287309573, 235008724579872652181722663904131823600]
#cs=[(x=getRandomRange(1, p=reduce(lambda x,y: x*y, ms))) % m  for m in ms]= [33294675495512365447936819977488986114, 167059006172538583650602409582350531874, 84260142588215759449080942199098236294, 187781777288843675003677762868332719566, 224545029830266627271846651706154185491, 90061147984988321355376057818169226157, 66745850796226643295313002664544925074, 71379202331049671317043059637642201894]


#V&N2020 公开赛]CRT(中国剩余定理模数不互质)
#https://blog.csdn.net/weixin_44110537/article/details/107396080
import hashlib
from functools import reduce
from Crypto.Util.number import *

ms = [getRandomNBitInteger(128) for i in range(8)]
p = reduce(lambda x,y: x*y, ms)
x = getRandomRange(1, p)
cs = [x % m  for m in ms]

flag = "flag{" + hashlib.sha256(str(x).encode()).hexdigest() + "}"
# assert("4b93deeb" in flag)

# ms = [284461942441737992421992210219060544764, 218436209063777179204189567410606431578, 288673438109933649911276214358963643204, 239232622368515797881077917549177081575, 206264514127207567149705234795160750411, 338915547568169045185589241329271490503, 246545359356590592172327146579550739141, 219686182542160835171493232381209438048]
# cs = [273520784183505348818648859874365852523, 128223029008039086716133583343107528289, 5111091025406771271167772696866083419, 33462335595116820423587878784664448439, 145377705960376589843356778052388633917, 128158421725856807614557926615949143594, 230664008267846531848877293149791626711, 94549019966480959688919233343793910003]
